<?php

namespace App\Models;

use App\Models\FhProduct;

use Illuminate\Database\Eloquent\Model;

class FhResourseList extends Model
{
	
    protected $table = 'fh_resourse_list';
    protected $fillable = ['r_name','r_desc', 'r_addr','p_id', 'r_url','show','r_type','n_url','product_id'];
    
    public static function boot()
    {
        parent::boot();

        static::saving(function ($model) {
           
            $model->p_id = FhProduct::where('id',$model->product_id)->value('pid');
           
        });
    }
}
